package logic.abilities;

import logic.characters.Player;

/**
 * @author Unai
 * 
 * Dash
 *
 */
public class Dash extends Ability{
	
	/**
	 * @param player
	 */
	public Dash(Player player) {
		super(player);
		cost = 7;
		pasive = false;
	}

	/* (non-Javadoc)
	 * @see logic.abilities.Ability#effect()
	 * Se mueve hacia atras rapido para evita golpes
	 */
	@Override
	public void effect() {
		if (player.stamina >= cost) {
			if (!player.attacking && !player.jumping && !player.throwing) {
				if (!player.dashing) {
					player.stamina -= cost;
				}

				if (player.lookingRight) {
					player.velX = -750;
				} else {
					player.velX = 750;
				}
				player.dashing = true;
				if (player.lookingRight) {
					player.updateIcon("resources" + player.getClass().getSimpleName() + "/RR.gif");
				}
			} else {
				player.updateIcon("resources" + player.getClass().getSimpleName() + "/RL.gif");
			}
			player.dibujar();
		}
		player.lastActionTime = System.currentTimeMillis();
		player.dibujar();
	}

		

	/* (non-Javadoc)
	 * @see logic.abilities.Ability#modifyAttributes()
	 * Innecesario
	 */
	@Override
	public void modifyAttributes() {
		// TODO Auto-generated method stub
		
	}

	/* (non-Javadoc)
	 * @see logic.abilities.Ability#updateFlags()
	 * Innecesario
	 */
	@Override
	public void updateFlags() {
		// TODO Auto-generated method stub
		
	}

}
